
class Element:
    def __init__(self):
        self.__nombre = ""
        self.__atributos = {}
        self.__texto = {'repr':'','str':''}
    
    def clear(self):
        self.__nombre = ""
        self.__texto['repr'] = ''
        self.__texto['str'] = ''
            
    def set_name(self, nombre):
        self.__nombre = nombre
    
    def set_text(self, texto):
        self.__texto['repr'] = repr(texto)
        texto = texto.encode('iso-8859-1')
        self.__texto['str'] = str(texto)
    
    def get_text(self, key):
        return self.__texto[key]
    
    def get_name(self):
        return self.__nombre
    
    def get_attributes(self):
        return self.__atributos
    
    def get_attribute(self, atributo):
        return self.__atributos[atributo]
    
    def set_attributes(self, atributos):
        self.__atributos = atributos.copy()
    
    def has_attribute(self, atributo):
        return self.__atributos.has_key(atributo)
    
    def is_empty(self):
        if self.__nombre == "":
            return True
        else:
            return False
    
    def __str__(self):
        return "Nombre: " + self.__nombre + "\nAtributos: " + str(self.__atributos) + "\nTexto: " + self.__texto['str']
